<template>
	<view class='container bg-w'>
		<view class="header uni-flex uni-row flex-between">
			<uni-nav-bar title="巡检记录">
				<template slot='left'>
					<view class="flex width-100">
						<i class='iconfont iconfanhui' @click='goBack()'></i>
					</view>
				</template>
			</uni-nav-bar>
		</view>
		<view class="position-r-top">
			<view class="buildList" v-if="personList.length">
				<uni-list>
					<uni-list-item showArrow v-for="(item, index) in personList" :key="index" :rightText='item.status=="0"?"继续巡检":"详情"'
					 link :to="item.status=='0'?'/pages/Application/Inspection/Inspection?groupId='+ item.groupId: '/pages/Application/Inspection/InspectionProject/InspectionInfo?groupId='+ item.groupId ">
						<template slot='body'>
							<view class="buildList-body">
								<view class="color-6 flex flex-between ">
									<text class="color-6" style="width: 140rpx;">所属项目：</text>
									<text class="color-6" style="flex: 1;">{{ item.projectName }}</text>
								</view>
								<view class="color-6 flex flex-between ">
									<text class="color-6" style="width: 140rpx;">所属单位：</text>
									<text class="color-6" style="flex: 1;">{{item.orgName}}</text>
								</view>
								<view class="color-6 flex flex-between ">
									<text class="color-6" style="width: 140rpx;">合格率：</text>
									<text class="color-6" style="flex: 1;">{{ item.passRate }}</text>
								</view>
							</view>
						</template>
					</uni-list-item>
				</uni-list>
				<view class="page_box">
					<uni-pagination title="标题文字" @change="handlePage" show-icon="false" :pageSize="page_Size" :total="total" :current="pageNo"></uni-pagination>
				</view>
			</view>
			<view class="nodata" v-else>
				<text>暂无数据</text>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		getRecordData
	} from "@/common/api/Inspection.js"
	export default {
		data() {
			return {
				personList: [],
				page_Size: 10,
				pageNo: 1,
				total: 100
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getData() {
				getRecordData({
					pageNo: this.pageNo,
					pageSize: this.page_Size,
				}).then(res => {
					this.personList = res.data.records;
					this.total = res.data.total
				})
			},
			onPullDownRefresh(){
				this.pageNo = 1;
				this.personList = [];
				this.getData();
				setTimeout(function () {
						uni.stopPullDownRefresh();
				}, 1000);
			},
			handlePage(params) {
				this.pageNo = params.current;
				this.getData();
			},
		}
	}
</script>

<style lang="less">
	.container {
		background-color: #F9F9F9;
	}

	.buildList {
		margin-top: 5rpx;

		.buildList-body {
			width: 82%;
			>view {
				view {
					width: 160rpx;
				}
			}
		}
	}
	
	/deep/.uni-pagination__btn[data-v-500d2664]{
		background-color: #09AAE9;
		color: #fff;
		padding: 0 6rpx;
		border-radius: 6rpx;
		border: none;
	}
	
	/deep/.uni-navbar--border[data-v-4afea59e] {
		border-bottom: 1px solid #fff !important;
	}

	.page_box {
		width: 100%;
		display: flex;
		justify-content: center;
		padding: 10px 0 20px 0;
	}


	/deep/.uni-list-item__extra-text[data-v-1093b690] {
		position: absolute;
		right: 10rpx;
	}
</style>
